var t = require("../../@babel/runtime/helpers/interopRequireDefault").default, e = t(require("../../kta/index")), a = require("../../config/Links"), n = t(require("../../api/api_YQYL.js")), o = require("../../utils/YQYL"), i = getApp();

e.default.Page({
    data: {
        imgBaseUrl: a.imageBaseUrl.YQYL_kd,
        options: {},
        successRecordList: [],
        userInfo: {},
        inviteNum: 0,
        shareUrl: null,
        poster: null,
        showPoster: !1,
        postUtil: {
            handleSharePoster: function() {}
        },
        modalType: !1,
        toastType1: !1,
        checked: !1,
        toastType2: !1,
        hbSelect: null,
        valid240: !1,
        valid28: !1,
        id_card_name: "",
        id_card_number: "",
        phone: "",
        check_token: ""
    },
    onShow: function() {},
    onShareAppMessage: function() {
        var t = this.data.userInfo.shareInfo;
        return i.kta.clickStat("97ae0d085dc443478cbb2944b69edba6"), {
            from: "button",
            title: t.title,
            path: "/pages/webview/index?url=".concat(encodeURIComponent(t.url)),
            imageUrl: a.imageBaseUrl.YQYL_kd + "share.jpg"
        };
    },
    handlePoster: function() {
        i.kta.clickStat("d6435f194e3a4977929b0d687fff4f96"), this.data.poster ? this.setData({
            showPoster: !0
        }) : this.data.postUtil.handleSharePoster();
    },
    handleClosePoster: function() {
        this.setData({
            showPoster: !1
        });
    },
    onUnload: function() {},
    onLoad: function(t) {
        var e = this;
        this.setData({
            options: t
        }), n.default.getRealInfo().then(function(t) {
            var a = t.real_name_info, n = a.id_card_name, o = a.id_card_number, i = a.check_token;
            e.setData({
                id_card_name: n,
                id_card_number: o,
                check_token: i
            });
        }).catch(function(t) {}), this.init();
    },
    init: function(t) {
        var e = this;
        (0, o.initPage)(this, this.data.options, "dl").then(function(t) {
            !t.receiveFlagOf28 && t.currentBalance >= 28 && e.setData({
                valid28: !0
            }), e.setData({
                valid240: t.currentBalance >= 240,
                toastType2: t.remindFlag
            });
        });
    },
    toRulePage: function() {
        i.kta.clickStat("4c00152cc3424f2abfed522819086639"), wx.navigateTo({
            url: "/pages/webview/index?url=".concat(encodeURIComponent("https://txwk.10010.com/wkpen/view/9b9F5ddf91.html"))
        });
    },
    toRecordPage: function() {
        wx.navigateTo({
            url: "/pages/YQYL_recorddl/index"
        });
    },
    handleCloseModal: function() {
        this.setData({
            modalType: null
        });
    },
    showModal: function(t) {
        var e = t.currentTarget.dataset.index;
        "1" === e && i.kta.clickStat("d40d496cce79422d9c63c845cda81b11"), this.setData({
            modalType: e
        });
    },
    checkProtocol: function() {
        this.setData({
            checked: !this.data.checked
        });
    },
    toProtocolPage: function() {
        wx.navigateTo({
            url: "/pages/webview/index?url=".concat(encodeURIComponent("https://txwk.10010.com/wkpen/view/96CCeC46a9.html"))
        });
    },
    submitIdcard: function() {
        var t = this;
        if (this.data.checked) {
            var e = this.data, a = {
                id_card_name: e.id_card_name,
                id_card_number: e.id_card_number,
                check_token: e.check_token
            };
            n.default.identify(a).then(function() {
                t.setData({
                    modalType: !1,
                    hbSelect: null
                });
            });
        } else wx.showToast({
            title: "请阅读并勾选活动协议",
            icon: "none",
            duration: 2e3
        });
    },
    handleCloseToast: function() {
        this.setData({
            toastType1: !1
        });
    },
    handleCloseToast2: function() {
        this.setData({
            toastType2: !1
        });
    },
    handleHbSelect: function(t) {
        var e = t.currentTarget.dataset.num;
        this.data.userInfo.receiveFlagOf28 && "28" === e || (this.data.valid240 && "240" === e || this.data.valid28 && "28" === e ? this.setData({
            hbSelect: e
        }) : wx.showToast({
            title: "提现余额不足",
            icon: "none",
            duration: 2e3
        }));
    },
    handleHbClick: function() {
        var t = this;
        this.data.hbSelect && n.default.getHF_dl({
            type: "28" === this.data.hbSelect ? 1 : 2
        }).then(function(e) {
            wx.showToast({
                title: "提现成功",
                icon: "none",
                duration: 2e3
            }), t.handleCloseModal(), setTimeout(function() {
                t.init();
            }, 2e3);
        }).catch(function(e) {
            "10000" === e.code ? t.setData({
                toastType1: "phone"
            }) : "10003" === e.code ? t.setData({
                toastType1: "1"
            }) : "30100" === e.code ? t.setData({
                modalType: "3",
                phone: i.globalData.phone
            }) : wx.showToast({
                title: e.msg,
                icon: "none",
                duration: 2e3
            });
        });
    },
    getPhoneNumber: function(t) {
        var e = this;
        this.setData({
            modalType: !1,
            toastType1: !1
        }), Auth.auth({
            encryptedData: t.detail.encryptedData,
            iv: t.detail.iv,
            source: 2
        }).then(function(t) {
            i.globalData.phone = t.data.phone, e.init();
        });
    }
});